<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <div id="id1">
        我的名字叫{{obj.name}},今年{{obj.age}}岁
        {{msg}}
    </div>
    <script>
        const { createApp, reactive, ref } = Vue
        createApp({
            setup() {
                //reactive只能传对象.不能是其他的类型.
                const obj = reactive({
                    name: '张三',
                    age: 19
                })
                const msg = ref('helloword')
                return {
                    obj,
                    msg
                }
            }
        }).mount('#id1')

        //ref和reactive的功能差不多,更加强大,就是reactive只能作用于对象,ref几乎什么都可以,并且在取值的时候不用.value.直接用即可.
    </script>
</body>

</html>